package 练习;

import java.util.Scanner;

/**
 * @Author Mucd
 * @ClassName Score
 * @Date 2020/12/12/012
 * @Specification Alibaba
 */
public class Score {
    public static void main(String[] args) {
        //定义6个评委,
        Scanner sc = new Scanner(System.in);
        int[] scores = new int[6];
        //输入六个评委分数
        for (int i = 0; i < scores.length; i++) {
            System.out.println("请输入第" + (i + 1) + "个评委");
            scores[i] = sc.nextInt();
        }
        //求六个评委最大值
        int max = scores[0];
        //将遍历到的数据给 k
        for (int k : scores) {
            if (k > max) {
                max = k;
            }
        }
        System.out.println("最大值:" + max);
        //求六个评委的最小值
        int min = scores[0];
        //将遍历到的数据给 j
        for (int j : scores) {
            if (j < min) {
                min = j;
            }
        }
        System.out.println("最小值:" + min);
        //元素总和
        int sum = 0;
        for (int score : scores) {
            sum += score;
        }
        System.out.println("总和:"+sum);
        //平均值  (所有分数的总和-最高分-最低分)/(数组长度-2)
        double average = (double)(sum-max-min)/(scores.length-2);
        System.out.println("平均分数:"+average);
    }
}
